﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
					xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
					xmlns:Controls="clr-namespace:FluidKit.Controls" xmlns:Experimental="clr-namespace:FluidKit.Experimental" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">

	<ControlTemplate x:Key="DefaultResultsListBoxItemTemplate"
					 TargetType="{x:Type ListBoxItem}">
		<Border x:Name="Border"
				CornerRadius="3"
				Background="Transparent">
			<ContentPresenter Margin="8,2,2,2" />
		</Border>

		<ControlTemplate.Triggers>
			<Trigger Property="IsSelected"
					 Value="True">
				<Setter Property="Foreground"
						Value="White" />
				<Setter Property="Background"
						TargetName="Border">
					<Setter.Value>
						<LinearGradientBrush StartPoint="0,0"
											 EndPoint="0,1">
							<GradientStop Color="LightBlue"
										  Offset="0" />
							<GradientStop Color="DarkBlue"
										  Offset="1" />
						</LinearGradientBrush>
					</Setter.Value>
				</Setter>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style x:Key="DefaultResultsListBoxStyle"
		   TargetType="{x:Type ListBox}">
		<Setter Property="ItemContainerStyle">
			<Setter.Value>
				<Style TargetType="{x:Type ListBoxItem}">
					<Setter Property="Template"
							Value="{StaticResource DefaultResultsListBoxItemTemplate}" />
				</Style>
			</Setter.Value>
		</Setter>
	</Style>

	<ControlTemplate x:Key="Template_AutoCompleteBox"
					 TargetType="{x:Type Experimental:AutoCompleteBox}">
		<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" d:DesignWidth="277" d:DesignHeight="52">
			<Grid d:DesignWidth="242" d:DesignHeight="146">
				<TextBox x:Name="PART_SearchTextBox"
					IsTabStop="True"
					Style="{TemplateBinding SearchTextBoxStyle}"
					Text="{Binding Text, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}" />
				<Popup x:Name="PART_Popup"
					IsOpen="{Binding IsResultsOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
					StaysOpen="False"
					Placement="Bottom"
					PlacementTarget="{Binding ElementName=PART_SearchTextBox}"
					AllowsTransparency="True"
					MinWidth="{Binding ActualWidth, ElementName=PART_SearchTextBox}"
					Focusable="False">
					<ListBox x:Name="PART_ResultsListBox"
						ScrollViewer.HorizontalScrollBarVisibility="Hidden"
						ScrollViewer.VerticalScrollBarVisibility="Hidden"
						HorizontalContentAlignment="Stretch"
						ItemsSource="{TemplateBinding ResultsItemsSource}"
						Style="{TemplateBinding ResultsListBoxStyle}"
						Margin="15"
						SelectionMode="Single"
						SelectedItem="{Binding SelectedItem, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">

						<ListBox.Effect>
							<DropShadowEffect BlurRadius="15"
								Opacity="0.75"
								Direction="-45"
								ShadowDepth="5" />
						</ListBox.Effect>
					</ListBox>
				</Popup>
				<Border x:Name="NoResults"
					BorderBrush="Transparent"
					BorderThickness="2"
					IsHitTestVisible="False" />
			</Grid>

		</Border>

		<ControlTemplate.Triggers>
			<Trigger Property="HasResults"
					 Value="False">
				<Setter Property="BorderBrush"
						Value="Red"
						TargetName="NoResults" />
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<Style TargetType="{x:Type Experimental:AutoCompleteBox}">
		<Setter Property="Template"
				Value="{StaticResource Template_AutoCompleteBox}" />
		<Setter Property="Height"
				Value="30" />
		<Setter Property="ResultsListBoxStyle"
				Value="{StaticResource DefaultResultsListBoxStyle}" />
	</Style>
</ResourceDictionary>